from  faker import Faker
import csv
if __name__ =='__main__':
    all_products= []
    fakerr =Faker(locale="zh_CN")
    for i in range(10000):

        ABC=(fakerr.name_male()
              )#男性姓名
        BCD=(fakerr.address())#地址
        CDE=(fakerr.postcode()) #邮编
        all_products.append({
            "姓名": ABC,
            "国家":BCD,
            "身份证":CDE})# 身份证号码
    keys =all_products[0].keys()
    with open("一万.txt","w",newline="",encoding='UTF-8') as o:
        dict_write= csv.DictWriter(o,keys)
        dict_write.writeheader()
        dict_write.writerows(all_products)